<template>
  <div style="height:500px;">
    <el-dialog title="查看导出" :visible.sync="dialogVisible">
      <el-button
        size="mini"
        type="primary"
        class="sx"
        @click.native="getList()"
        icon="el-icon-refresh"
      >刷新</el-button>
      <el-table
        :data="list"
        border
        style="width: 100%;padding:10px;margin-top:10px"
        height="400"
        v-loading="listLoading"
      >
        <el-table-column prop="createTime" align="center" label="导出时间">
          
        </el-table-column>

        <el-table-column prop="filename" align="center" label="文件名">
        
        </el-table-column>

        <el-table-column prop="progress" align="center" label="导出进度">
        
        </el-table-column>

        <el-table-column prop="stat" align="center" label="导出状态">
          <template slot-scope="scope">
            <span v-html="scope.row.stat"></span>
          </template>
        </el-table-column>

        <el-table-column align="center" label="下载">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" v-if="scope.row.show" @click.native="download(scope.row)">下载</el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="data.pageNo"
        :limit.sync="data.pageSize"
        @pagination="getList"
      />
    </el-dialog>
  </div>
</template>

<script>
import apiexportLogs from "@/api/export/exportLogs";
import Pagination from "@/components/Pagination";
export default {
  name: "index",
  components: { Pagination },
  data() {
    return {
      total: 0,
      dialogVisible: false,
      list: [],
      listLoading: true,
      data: {
        pageNo: 1,
        pageSize: 10
      }
    };
  },
  created() {},
  methods: {
    //列表查询
    getList() {
      this.listLoading = true;
      apiexportLogs.getListquery(this.data.pageNo, this.data.pageSize).then(res => {
          this.list = res.list;
          this.total = res.total;
          this.listLoading = false;
        });
    },
    //查看导出
    open() {
      this.getList();
      this.dialogVisible = true;
    },
    //下载
    download(row) {
      apiexportLogs.download(row.filePath);
    }
  }
};
</script>

<style scoped>
</style>